package com.xpertline.ui.factory;

import java.util.Calendar;
import java.util.Date;

import javax.swing.JSpinner;
import javax.swing.SpinnerDateModel;

public final class TimeSpinnerFactory {
	/**
	 * @wbp.factory
	 */
	public static JSpinner createJTimeSpinner() {
		Date date = new Date();
		SpinnerDateModel sm = new SpinnerDateModel(date, null, null,
				Calendar.HOUR_OF_DAY);
		JSpinner spinner = new JSpinner(sm);
		JSpinner.DateEditor de = new JSpinner.DateEditor(spinner, "hh:mm");
		spinner.setEditor(de);
		spinner.setFont(CommonUIProperties.FONT);
		return spinner;
	}
	
	@SuppressWarnings("deprecation")
	public static JSpinner createJTimeSpinner(int hours, int minutes) {
		Date date  = new Date();
		date.setHours(hours);
		date.setMinutes(minutes);
		SpinnerDateModel sm = new SpinnerDateModel(date, null, null,
				Calendar.HOUR_OF_DAY);
		JSpinner spinner = new JSpinner(sm);
		JSpinner.DateEditor de = new JSpinner.DateEditor(spinner, "hh:mm");
		spinner.setEditor(de);
		spinner.setFont(CommonUIProperties.FONT);
		return spinner;
	}
}